package com.gxa.meiye.portal.shop.shopLogin.service.impl;

import com.gxa.meiye.portal.shop.shopLogin.service.GetBackPwdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Service;

/**
 * @Author cc
 * @PackageName meiye
 * @Package com.gxa.portal.shop.shopLogin.service.impl
 * @Date 2022/7/26 9:51
 * @Version 1.0
 */
@Service
public class GetBackPwdServiceImpl implements GetBackPwdService {

    @Autowired
    JavaMailSenderImpl mailSender;//注入JavaMailSenderImpl对象，这里需要注入对象

    @Override
    public void send(String getBackPwdEmail, String getBackPwdCode) {
        SimpleMailMessage mailMessage = new SimpleMailMessage();//创建一个简单的邮件信息对象
        //设置邮件发送信息的内容
        mailMessage.setSubject("美业项目验证码");//标题
        mailMessage.setText("[找回此账号的密码] 您的验证码为:" + getBackPwdCode + "验证码5分钟内有效,请勿泄露。");//内容
        mailMessage.setFrom("1662001405@qq.com");//内容为发送方的邮箱地址
        mailMessage.setTo(getBackPwdEmail);//内容为接收方邮箱地址
        mailSender.send(mailMessage);//发送邮件
    }
    }
